<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>18、表单属性指令-v-model.html</title>
</head>
<body>

<div id="app">
    <input type="text" v-model="username">
    <h1>你输入的值是：{{username.length}}</h1>
    <input type="text" v-model.trim="username2">
    <h1>你输入的值是：{{username2.length}}</h1>
    <input type="text" v-model.number="age">
    <h1>你输入的值是：{{age}}</h1>
    <button @click="loginbtn">登录</button>
</div>

<script src="js/vue.global.js"></script>
<script>
    var vm = Vue.createApp({
        created(){
        },
        data() {
            return {
                age:20,
                username:"",
                username2:""
            }
        },
        methods:{
            loginbtn(){
                var username = this.username;
                alert("你登录的用户是===>" + username)
            }
        }

    }).mount("#app");
</script>

</body>
</html>